<?php
namespace app\validate;
use share\validate\SceneValidate;

class DeviceBaseValidate extends SceneValidate{

    /**
     * 通用规则
     */
    protected $rule = [
        'id' => 'require|integer',
        'pid' => 'require|integer',
        'pk' => 'require|length:1,50',
        'dn' => 'require|length:1,50',
        'iot_id' => 'require|length:1,60',
        'serial_no' => 'require|length:1,60',
        'server_site' => 'length:2,5',
        'aliyun_project_id' => 'require|integer',
        
    ];    

    /**
     * 自定义场景的规则
     */
    protected $sceneRules = [
        'list' =>[     
            'id' => 'integer',
            'pid' => 'integer',
            'pk' => 'length:1,50',
            'dn' => 'length:1,50',
            'iot_id' => 'length:1,60',
            'serial_no' => 'length:1,60',
        ],
    ];

    protected $scene = [
        'list' => ['id','pid','pk','dn','iot_id','serial_no'],
        'detail' => ['id'],
        'getSimple' => ['pk','dn'],
        'set' => ['id','pk','dn','iot_id','serial_no','server_site','aliyun_project_id']
    ];
}
